package com.xinqi.modules.prepare.question.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinqi.common.mybatis.data.repo.SuperMapper;
import com.xinqi.modules.prepare.question.domain.PrepareQuestionBankEntity;
import com.xinqi.modules.prepare.question.dto.req.PrepareQuestionBankQueryDTO;
import com.xinqi.modules.prepare.question.dto.rsp.PrepareQuestionBankResultDTO;
import com.xinqi.modules.prepare.question.dto.rsp.QuestionTypeStatsDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 备课区测评卷试题表数据层
 *
 * @author: system
 * @date: 2023/03/19
 */
@Mapper
public interface PrepareQuestionBankMapper extends SuperMapper<PrepareQuestionBankEntity> {
    Page<PrepareQuestionBankResultDTO> findPage(Page<Object> page, @Param("dto") PrepareQuestionBankQueryDTO query);

    List<PrepareQuestionBankResultDTO> findList(@Param("dto") PrepareQuestionBankQueryDTO query);

    List<QuestionTypeStatsDetail> questionStats(@Param("prepareId") Long prepareId);

    List<PrepareQuestionBankEntity> findByRandom(@Param("prepareId") Long prepareId,
                                                 @Param("type") String type,
                                                 @Param("num") Integer num);

    List<PrepareQuestionBankResultDTO> selectQuestionsByIds(@Param("ids") List<Long> ids);

    List<PrepareQuestionBankEntity> selectQuestionEntitiesByIds(@Param("ids") List<Long> ids);
}
